<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./vue.js"></script>
</head>
<body>
<div id="root">
    <input v-model.trim="keyword" type="text">
    <p v-for="(item,index) in searchArr">{{item}}</p>
</div>
</body>
<script>
    new Vue({
        el: '#root',
        data:{
            keyword: '',
            searchArr:[],
            arr:["zhangsan","lisi","wangwu","zhaoliu","yanqi","shenba","qianshi","xiaoshiyi"]
        },
        watch:{
            keyword(){
                this.searchArr = this.arr.filter(v=>this.keyword && v.includes(this.keyword));
            }
        }
    })
</script>
</html>